home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Environments / Clean 1.2.4 / PowerMacInterface / memory.icl < prev    next >
Encoding:
Modula Implementation  |  1997-02-14  |  1.5 KB  |  60 lines  |  [TEXT/3PRM]

  1. implementation module memory;
  2.  
  3. import mac_types;
  4.  
  5. NewHandle :: !Int !Toolbox -> (!Handle,!Int,!Toolbox);
  6. NewHandle logicalSize t = (handle,error,0);
  7. {
  8.     error=MemError t2;
  9.     (handle,t2)=NewHandle2 logicalSize t;
  10. }
  11.  
  12.     NewHandle2 :: !Int !Toolbox -> (!Handle,!Toolbox);
  13.     NewHandle2 logicalSize t = code (logicalSize=D0,t=U)(handle=D0,z=Z){
  14.         call    .NewHandle
  15.     };
  16.  
  17. DisposHandle :: !Handle !Toolbox -> (!Int,!Toolbox);
  18. DisposHandle h t = code (h=D0,t=U)(result_code=D0,z=Z){
  19.     call    .DisposeHandle
  20. };
  21.  
  22. NewPtr :: !Int !Toolbox -> (!Ptr,!Int,!Toolbox);
  23. NewPtr logicalSize t = (pointer,error,0);
  24. {
  25.     error=MemError t2;
  26.     (pointer,t2)=NewPtr2 logicalSize t;
  27. }
  28.  
  29.     NewPtr2 :: !Int !Toolbox -> (!Ptr,!Toolbox);
  30.     NewPtr2 logicalSize t = code (logicalSize=D0,t=U)(pointer=D0,z=Z){
  31.         call    .NewPtr
  32.     };
  33.  
  34. DisposPtr :: !Ptr !Toolbox -> (!Int,!Toolbox);
  35. DisposPtr p t = code (p=D0,t=U)(result_code=D0,z=Z){
  36.     call    .DisposePtr
  37. };
  38.  
  39. MemError :: !Toolbox -> Int;
  40. MemError t = code (t=U)(r=D0){
  41.     call    .MemError
  42. };
  43.  
  44. GetHandleSize :: !Handle !Toolbox -> (!Int,!Toolbox);
  45. GetHandleSize handle t = code (handle=D0,t=U)(result_code=D0,z=Z){
  46.     call    .GetHandleSize
  47. }
  48.  
  49. GetPtrSize :: !Int !Toolbox -> (!Int,!Toolbox);
  50. GetPtrSize p t = code (p=D0,t=U)(size=D0,z=Z){
  51.     call    .GetPtrSize
  52. };
  53.  
  54. copy_handle_data_to_string :: !{#Char} !Handle !Int !Toolbox -> Toolbox;
  55. copy_handle_data_to_string string handle size tb = code (string=U,handle=D1,size=D2,tb=U)(z=Z){
  56.     instruction 0x80640000    |    lwz        r3,0(r4)
  57.     instruction 0x38970008    |    addi    r4,r23,8    
  58.     call    .BlockMoveData
  59. }
  60.